{include file="public/header"/}
<style>
	.manage-wrap {
		margin: 0 auto;
		width: 300px;
	}

	.manage-wrap .ui-input {
		width: 200px;
		font-size: 14px;
	}

	.manage-wrap .hideFeild {
		position: absolute;
		top: 30px;
		left: 80px;
		width: 210px;
		border: solid 1px #ccc;
		background-color: #fff;
	}

	.ztreeDefault {
		overflow-y: auto;
		max-height: 240px;
	}

	.searchbox {
		float: left;
		font-size: 14px;
	}

	.searchbox li {
		float: left;
		margin-right: 10px;
	}

	#matchCon {
		width: 140px;
	}

	.ui-input-ph {
		color: #aaa;
	}

	.cur #custom-assisting .ui-combo-wrap {
		background: #eaeaea;
		border-color: #c1c1c1;
	}

	.cur #custom-assisting input {
		background: #eaeaea;
		font-weight: bold;
	}

	.ui-droplist-wrap .selected {
		background-color: #d2d2d2;
	}

	.input-txt {
		font-size: 14px;
	}

	.ui-droplist-wrap .list-item {
		font-size: 14px;
	}

	.url-box {
		height: 28px;
		line-height: 28px;
	}

	.url-box a {
		margin-right: 5px;
	}
</style>
<div class="wrapper">

	<div class="mod-toolbar-top cf">
		<div class="left">
			<!--<div class="mod-crumb fl"><span class="cur"></span></div>-->
			<div id="assisting-category-select" class="ui-tab-select">
				<strong class="tit">类别</strong>
				<ul class="ui-tab mrb">
					<li data-id="customerCategoryList" class="cur">客户</li>
					<li data-id="customerCategoryList" data-url="/admin/suppliercategory/index.html">供应商</li>
					<li data-id="customerCategoryList" data-url="/admin/goodscategory/index.html">商品</li>
					<li data-id="customerCategoryList" data-url="/admin/moneytype/index.html">支出</li>
					<li data-id="customerCategoryList" data-url="/admin/incometype/index.html">收入</li>
				</ul>
				<span class="fl mrb dn">
					<span id="custom-assisting"><span class="ui-combo-wrap" style="width: 168px;"><input type="text"
								class="input-txt" autocomplete="off" readonly="readonly"
								style="cursor: default; width: 142px;"><span class="trigger"></span></span></span>
				</span>
				<ul class="searchbox cf">
					<li>
						<input type="text" id="matchCon" class="ui-input ui-input-ph matchCon" placeholder="输入类别名称查询"
							style="color: #000;">
					</li>
					<li><a class="ui-btn mrb ui-btn-search" id="search">查询</a></li>
					<!-- <li class="url-box">类别新增</li> -->
				</ul>
			</div>
		</div>
		<div class="fr"><a href="#" class="ui-btn ui-btn-sp mrb ui-btn-add" id="btn-add"
				onclick="lopen('add.html','新增', '400px', '300px')">新增</a><a class="ui-btn ui-btn-normal"
				id="btn-refresh" onclick="reload();">刷新</a></div>
	</div>





	<div class="grid-wrap">
		<table id="grid">
		</table>
		<!-- <div id="page"></div> -->
	</div>


	<script type="text/javascript">


		$(document).ready(function () {

			// 点击查询按钮
			$("#search").click(function () {
				var typeName = $("#matchCon").val();
				$("#grid").jqGrid('setGridParam', {
					datatype: 'json',
					postData: {
						'ajax': '100',
						name: typeName
					}, //发送数据 
					page: 1
				}).trigger("reloadGrid"); //重新载入 
			});

			$("#grid").jqGrid({
				url: '/admin/customercategory/index.html?ajax=100',
				datatype: "json",//数据来源，本地数据（local，json,jsonp,xml等）
				height: '90%',//高度，表格高度。可为数值、百分比或'auto'
				//width: Public.setGrid().w,
				//height: Public.setGrid().h,
				colNames: ["操作", "类别"],
				colModel: [
					{ name: 'id', index: 'id', width: 70, formatter: cLink },
					{ name: 'name', width: 200, formatter: cName },
				],
				// rowNum: 10,
				// rowList: [10, 20, 30],
				sortname: 'id',
				sortorder: "desc",
				pagerpos: "left",//分页位置

				pgbuttons: true,//翻页按钮
				pagination: true,
				altRows: !0,
				gridview: !0,
				shrinkToFit: !1,
				cellLayout: 8,
				autowidth: !0,
				pager: "#page",
				viewrecords: !0,
				cmTemplate: {
					sortable: !1,
					title: !1
				},
				loadError: function (t, e, i) {
					parent.Public.tips({
						type: 1,
						content: "操作失败了哦，请检查您的网络链接！"
					})
				}
			});

		});

		function cLink(cellvalue, options, rowObject) {
			return '<div class="operating"><span class="ui-icon ui-icon-pencil" onclick="lopen(\'edit.html?id=' + rowObject.id + '\',\'编辑\',\'400px\',\'300px\')" title="修改"></span><span class="ui-icon ui-icon-trash" onclick="del(' + rowObject.id + ')" title="删除"></span></div>'
		}

		function cName(cellvalue, options, rowObject) {
			// console.log(rowObject)
			// console.log(rowObject.parentId)
			var content = rowObject.parentId == 0 ? cellvalue : " |- " + cellvalue;
			return '<div style="padding-left:' + (rowObject.level * 12) + 'px">' + content + '</div>'
		}
	</script>

	{include file="public/footer"/}